package za.co.felixsol.sf.gcode.instructions;

public abstract class AxisInstruction extends Instruction {

	private InstructionParameter x;
	private InstructionParameter y;
	private InstructionParameter z;
	private InstructionParameter a;
	private InstructionParameter b;
	private InstructionParameter c;
	private InstructionParameter u;
	private InstructionParameter v;
	private InstructionParameter w;
	
	public AxisInstruction() {
		super();
	}
	
	public AxisInstruction(Double x, Double y, Double z) {
		this();
		this.x = createParameter("X", 0, x);
		this.y = createParameter("Y", 1, y);
		this.z = createParameter("Z", 2, z);
	}

	public Double getX() {
		if (x == null) return null;
		return (Double)x.getValue();
	}

	public void setX(Double x) {
		if (this.x == null) this.x = createParameter("X");
		this.x.setValue(x);
	}

	public Double getY() {
		if (y == null) return null;
		return (Double)y.getValue();
	}

	public void setY(Double y) {
		if (this.y == null) this.y = createParameter("Y");
		this.y.setValue(y);
	}

	public Double getZ() {
		if (z == null) return null;
		return (Double)z.getValue();
	}

	public void setZ(Double z) {
		if (this.z == null) this.z = createParameter("Z");
		this.z.setValue(z);
	}

	public Double getA() {
		if (a == null) return null;
		return (Double)a.getValue();
	}

	public void setA(Double a) {
		if (this.a == null) this.a = createParameter("A");
		this.a.setValue(a);
	}

	public Double getB() {
		if (b == null) return null;
		return (Double)b.getValue();
	}

	public void setB(Double b) {
		if (this.b == null) this.b = createParameter("B");
		this.b.setValue(b);
	}

	public Double getC() {
		if (c == null) return null;
		return (Double)c.getValue();
	}

	public void setC(Double c) {
		if (this.c == null) this.c = createParameter("C");
		this.c.setValue(c);
	}

	public Double getU() {
		if (u == null) return null;
		return (Double)u.getValue();
	}

	public void setU(Double u) {
		if (this.u == null) this.w = createParameter("U");
		this.u.setValue(u);
	}

	public Double getV() {
		if (v == null) return null;
		return (Double)v.getValue();
	}

	public void setV(Double v) {
		if (this.v == null) this.v = createParameter("V");
		this.v.setValue(v);
	}

	public Double getW() {
		if (w == null) return null;
		return (Double)w.getValue();
	}

	public void setW(Double w) {
		if (this.w == null) this.w = createParameter("W");
		this.w.setValue(w);
	}

}
